Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a pure v3 client #298

Merged
merged 14 commits into from
Sep 18, 2024
Merged

Create a pure v3 client #298

merged 14 commits into from
Sep 18, 2024

Conversation

nplasterer
Copy link
Contributor

In order to properly test 1to1 it would be nice to be able to create a pure v3 client. This will be necessary once we support SCW as well.

@nplasterer nplasterer self-assigned this Sep 16, 2024
@nplasterer nplasterer marked this pull request as ready for review September 16, 2024 23:45
@nplasterer nplasterer requested a review from a team as a code owner September 16, 2024 23:45
Comment on lines 728 to 736
val privateKeyBundle: PrivateKeyBundle
get() = PrivateKeyBundleBuilder.buildFromV1Key(privateKeyBundleV1)
get() = PrivateKeyBundleBuilder.buildFromV1Key(v1keys)

val v1keys: PrivateKeyBundleV1
get() = privateKeyBundleV1
get() = privateKeyBundleV1 ?: throw XMTPException("V2 only function")

val keys: PrivateKeyBundleV2
get() = privateKeyBundleV1.toV2()
get() = v1keys.toV2()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic all seems fine here, but these names seem very confusing for me personally. The names aren't new in this PR though, so no need to block the change.

an example improvement might be:
( we already have the nullable class field privateKeyBundleV1)

  • v1keys could instead be called something like nonNullPrivateKeyBundleV1
  • keys could instead be called privateKeyBundleV2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya this one really thew me off as well something I will be happy to kill with V2.

Copy link
Contributor

@cameronvoell cameronvoell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes all look good, just adding some ideas/nits related to code organization. I think the new client v3 constructor, and making privateKeyBundleV1 and apiClient both nullable is the right idea 👍

@nplasterer
Copy link
Contributor Author

All tests pass 🎉

Screenshot 2024-09-18 at 11 48 31 AM

@cameronvoell cameronvoell self-requested a review September 18, 2024 17:51
Copy link
Contributor

@cameronvoell cameronvoell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice updates! :shipit:

@nplasterer nplasterer enabled auto-merge (squash) September 18, 2024 18:04
@nplasterer nplasterer merged commit 8e37581 into main Sep 18, 2024
5 of 6 checks passed
@nplasterer nplasterer deleted the np/v3-only-client branch September 18, 2024 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants